package org.chameleon.threadpool;

import io.netty.util.Timeout;
import io.netty.util.TimerTask;
import org.chameleon.threadpool.pool.DynamicThreadPool;

import java.util.concurrent.TimeUnit;

public class MonitorTimerTask implements TimerTask {

    private final DynamicThreadPool threadPool;

    public MonitorTimerTask(DynamicThreadPool threadPool) {
        this.threadPool = threadPool;
    }


    @Override
    public void run(Timeout timeout) throws Exception {
        final int activeCount = threadPool.getActiveCount();
        final int corePoolSize = threadPool.getCorePoolSize();
        final long keepAliveTime = threadPool.getKeepAliveTime(TimeUnit.SECONDS);
        final long completedTaskCount = threadPool.getCompletedTaskCount();
        final int size = threadPool.getQueue().size();
        final long taskCount = threadPool.getTaskCount();
    }

}
